package flca.osm.perst.util;


public enum TransactionHelper
{
	INSTANCE;
	
	private static int SHOW_COUNT = 50000;
	
	private int nNodes = 0;
	private int nWays = 0;
	private int nCorners = 0;

	public void incNodes() {
		nNodes++;
		if (nNodes == 1 || nNodes % SHOW_COUNT == 0) {
			System.out.println("node: "  + nNodes);
			PerstDbHelper.getInstance().commit();
		}
	}

	public void incWays() {
		nWays++;
		if (nWays == 1 || nWays % SHOW_COUNT == 0) {
			System.out.println(" way: " + nWays);
			PerstDbHelper.getInstance().commit();
		}
	}

	public void incCorners() {
		nCorners++;
		if (nCorners == 1 || nCorners % SHOW_COUNT == 0) {
			System.out.println(" corners: " + nCorners);
			PerstDbHelper.getInstance().commit();
		}
	}

	public int getNodesCount() {
		return nNodes;
	}

	public int getWaysCount() {
		return nWays;
	}

	public int getCornerCount()
	{
		return nCorners;
	}
	

}
